package com.training;

import java.io.*;
class Firstt
{
void disp()
{
System.out.println("First-Hello");
}
}
class Second2 extends Firstt
{
void disp()
{
System.out.println("Second-Hello");
}
}
class Main
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int ch;
Firstt ptr;
Firstt f = new Firstt();
Second2 s = new Second2();
do
{
System.out.println("first-1");
System.out.println("second-2");
System.out.println("exit-3");
System.out.println("Enter your choices");
ch = Integer.parseInt(br.readLine());
switch(ch)
{
case 1:
ptr = f;
ptr.disp();
break;
case 2:
ptr = s;
ptr.disp();
break;
case 3:
System.exit(0);
default:
System.out.println("Invalid choice");
}
}
while(ch!=3);
}
}